package com.wn.potal.config;

import com.alibaba.csp.sentinel.adapter.spring.webmvc.callback.RequestOriginParser;
import com.alibaba.nacos.api.utils.StringUtils;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;

@Component
public class HeaderOriginParser implements RequestOriginParser {

    @Override
    public String parseOrigin(HttpServletRequest httpServletRequest) {
        String header = httpServletRequest.getHeader("origin");
        System.out.println("header = " + header);
        if(StringUtils.isBlank(header)){
            header = "blank";
        }
        return header;
    }
}